from public.action import *
from public.business import *
from public.testData import *
from public.tools import *
import time

testCase = "DBshop0022_商品管理商品品牌删除"

firefox = openBrowser(urlAdmin) #打开后台网页
DBshopLoginAdmin(firefox)   #后台登录
DBshopEnterMenu2(firefox,'商品管理','商品品牌')

# 1.点击“删除”按钮，确定删除，删除成功。
firefox.find_element_by_xpath("//td[contains(.,'苹果')]/following-sibling::td[4]/a[2]").click()
time.sleep(3)
firefox.switch_to.alert.accept()
time.sleep(3)

try:
    firefox.find_element_by_xpath("//td[contains(.,'苹果')]").is_displayed()
    writeLog("%s 测试失败"%testCase)
    getPhoto(firefox)
except:
    writeLog("%s 测试通过" % testCase)
firefox.quit()